using TinaX;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace Nekonya.Components
{
    [DisallowMultipleComponent]
    public class DontKillMe : MonoBehaviour
    {
        void Awake()
        {
            this.gameObject.DontDestroy();
        }
    }

#if UNITY_EDITOR

    [CustomEditor(typeof(DontKillMe))]
    public class DontKillMeCustom : Editor
    {
        private GUIStyle _titleLabelStyle;
        private GUIStyle m_TitleLabelStyle
        {
            get
            {
                if (_titleLabelStyle == null)
                {
                    _titleLabelStyle = new GUIStyle(EditorStyles.largeLabel);
                    _titleLabelStyle.alignment = TextAnchor.MiddleCenter;
                    _titleLabelStyle.fontStyle = FontStyle.Bold;
                    _titleLabelStyle.fontSize = 16;
                }
                return _titleLabelStyle;
            }
        }

        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("没有GameObject受伤的世界达成了", m_TitleLabelStyle);
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("这个组件可以让其所在的GameObject在切换场景的时候不会跟着场景一起被销毁掉", MessageType.Info);


            //base.OnInspectorGUI();
        }
    }
#endif


}


